package smedi.ismedi.web.bff.controller.report;

import com.github.pagehelper.PageInfo;
import com.smedi.ismedi.report.api.feign.RemoteReportDashboardFeignApi;
import com.smedi.ismedi.report.api.model.dto.ReportDashboardDto;
import com.smedi.ismedi.report.api.model.request.ReportDashboardRequest;
import com.smedi.ismedi.report.api.model.vo.LookBankVO;
import com.smedi.ismedi.web.starter.common.PaginationData;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RequestMapping(value = "/webbff/v1/dashboard")
@RestController
@Api(tags = {"任务看板"})
public class RemoteReportDashboardController {

    @Autowired
    RemoteReportDashboardFeignApi remoteReportDashboardFeignApi;

    @ApiOperation(value = "角标", nickname = "角标")
    @GetMapping("/count")
    public ResponseData<LookBankVO> getLookBankCount(){
        return  remoteReportDashboardFeignApi.getLookBankCount();
    }

    @PostMapping({"/listWait"})
    @ApiOperation(value = "获取任务看板待填报列表",nickname = "获取任务看板待填报列表" )
    public ResponseData<PaginationData<ReportDashboardDto>> getListWait(@RequestBody ReportDashboardRequest request){

        return remoteReportDashboardFeignApi.getListWait(request);
    }

    @PostMapping({"/listFilled"})
    @ApiOperation(value = "获取任务看板已填报列表",nickname = "获取任务看板已填报列表" )
    public ResponseData<PaginationData<ReportDashboardDto>> getListFilled(@RequestBody ReportDashboardRequest request){

        return remoteReportDashboardFeignApi.getListFilled(request);
    }

    @PostMapping({"/listOverdue"})
    @ApiOperation(value = "获取任务看板已逾期列表",nickname = "获取任务看板已逾期列表" )
    public ResponseData<PaginationData<ReportDashboardDto>> getListOverdue(@RequestBody ReportDashboardRequest request){

        return remoteReportDashboardFeignApi.getListOverdue(request);
    }

    @PostMapping({"/listReject"})
    @ApiOperation(value = "获取任务看板驳回列表",nickname = "获取任务看板驳回列表" )
    public ResponseData<PaginationData<ReportDashboardDto>> getListReject(@RequestBody ReportDashboardRequest request){

        return remoteReportDashboardFeignApi.getListReject(request);
    }


    @ApiOperation(value = "历史任务", nickname = "历史任务")
    @PostMapping("/history")
    ResponseData<PaginationData<ReportDashboardDto>> getListHistory(@RequestBody ReportDashboardRequest request){
        return remoteReportDashboardFeignApi.getListHistory(request);
    }

    @GetMapping("/taskTotal")
    @ApiOperation(value = "我的待办、本月完成数、累计完成数",nickname = "我的待办、本月完成数、累计完成数" )
    public ResponseData<Map<String, Integer>> getTaskTotal(){
        return remoteReportDashboardFeignApi.getTaskTotal();
    }


    @ApiOperation(value = "删除历史任务", nickname = "删除历史任务")
    @DeleteMapping("/history/{taskId}")
    ResponseData<String> deletetHistory(@PathVariable("taskId") Long taskId){

        return  remoteReportDashboardFeignApi.deletetHistory(taskId);
    }
}
